package training;
import java.util.*;
import java.util.HashMap;
// https://www.nowcoder.com/questionTerminal/05f97d9b29944c018578d98d7f0ce56e
public class Day37_01 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int a = in.nextInt();
            in.nextLine();
            String[] arr = new String[a];
            for (int i = 0; i < arr.length; i++) {
                arr[i] = in.nextLine();
            }
            int res = 0;
            HashMap<Character, Integer> hashMap = new HashMap<>();
            for (int i = 0; i < arr.length; i++) {
                char c = arr[i].charAt(0);
                if (!arr[i].contains("dis")) {
                    hashMap.put(c, 1);
                    res = Math.max(res, hashMap.size());
                } else {
                    hashMap.remove(c);
                }
            }
            System.out.println(res);
        }
    }
}
